<script setup lang="ts">
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'

const {locale} = useI18n()
const language = computed(() => (locale.value === 'zh-cn' ? zhCn : en))
const layout = "default"

useHead({
  script: [
    {
      id: 'TongJiCode',
      innerHTML: 'window.dataLayer = window.dataLayer || [];\n' +
          '        var _hmt = _hmt || [];\n' +
          '        (function () {\n' +
          '            var hm = document.createElement("script");\n' +
          '            hm.src = "//hm.baidu.com/hm.js?8256d4dba8b2d771ee7b8fbab3a6df7d";\n' +
          '            var gl = document.createElement("script");\n' +
          '            gl.src = "//www.googletagmanager.com/gtag/js?id=G-MJ875WYP0C";\n' +
          '            var s = document.getElementsByTagName("script")[0];\n' +
          '            s.parentNode.insertBefore(hm, s);\n' +
          '            s.parentNode.insertBefore(gl, s);\n' +
          '            dataLayer.push(\'js\', new Date());\n' +
          '            dataLayer.push(\'config\', \'G-MJ875WYP0C\');\n' +
          '        })();\n' +
          '        (function(c,l,a,r,i,t,y){\n' +
          '            c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\n' +
          '            t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i+"?ref=bwt";\n' +
          '            y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);\n' +
          '        })(window, document, "clarity", "script", "kscdqn6f2x");'
    }
  ],
  meta: [
    {property: "og:image", content: "/og-image.png"}
  ]
})
</script>

<template>
  <NuxtLayout :name="layout">
    <el-config-provider :locale="language">
      <NuxtPage/>
    </el-config-provider>
  </NuxtLayout>
</template>
